#pragma once

#include "MutualWorkerController.h"


class CParser :
	public CMutualWorkerController
{
private:
	CStringA &m_rScript;
	UINT nLength;
	UINT nCursor;

	std::map<CStringA, CStringA> m_mapMacros;

	VOID SkipWhiteSpacesAndNewLines(BOOL bExpectEof);
	VOID SkipWhiteSpaces();
	VOID SkipAtLeastOneWhiteSpace();
	VOID SkipAtLeastOneNewLine();

	BOOL NextIsAlpha();
	BOOL NextIsAlphanum();

	LONG ReadNumber();
	CStringA ReadIdentifier();
	CStringA ReadString();

public:
	CParser(CStringA &a_rScript);

	VOID Parse();

	BOOL NextIs(LPCSTR pszCompare);
	VOID CheckNext(LPCSTR pszCheck);

	VOID ParseDefine();

};
